<?php
namespace PsiFramework\Classes\Util\Database\Query;

import("Classes.Util.Database.Query.SqlParameter");

use \PsiFramework\Classes\Util\Database\Query\SqlParameter;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The SqlType class allows to represent a sql type
 *
 * @package classes.util.xpersist.sql
 */
class SqlType extends SqlParameter
{

    public static /*string*/ $serial = "SERIAL" ;

    public static /*string*/ $integer = "INTEGER" ;
    public static /*string*/ $float = "FLOAT" ;
    public static /*string*/ $double = "DOUBLE" ;
    public static /*string*/ $long = "LONG" ;

    public static /*string*/ $varchar = "VARCHAR" ;
    public static /*string*/ $char = "CHAR" ;
    public static /*string*/ $text = "TEXT" ;

    public static /*string*/ $boolean = "BOOLEAN" ;

    public static /*string*/ $dateTime = "DATETIME" ;

    public static /*string*/ $blob = "BLOB" ;


    protected /*string*/ $_type ;
    protected /*int*/    $_length ;
    protected /*bool*/   $_null ;


    public function __construct(
        /*string*/ $type=null,
        /*int*/    $length=null,
        /*bool*/   $null=true
    )
    {
        $this->_type = $type ;
        $this->_length = $length ;
        $this->_null = $null ;
    }

    public function setType(/*string*/ $type)
    {
        $this->_type = $type ;
    }

    public function getType()
    {
        return $this->_type ; ;
    }

    public function setLength(/*int*/ $length)
    {
        $this->_length = $length ;
    }

    public function getLength()
    {
        return $this->_length ;
    }

    public function setNull(/*bool*/ $null)
    {
        $this->_null = $null ;
    }

    public function canBeNull()
    {
        return $this->_null ;
    }
}

